<!-- 4
 * @Description: 物料属性面板

 * @Date: 2022-01-13 15:31:38

 * @LastEditTime: 2022-01-28 11:49:52
-->
<template>
  <div class="Config">
    <config-ctn v-if="control.curWidget" :title="control.curWidget.name">
      <custom-schema-template
        :schema="curSchema"
        v-model="control.curWidget"
      ></custom-schema-template>
    </config-ctn>

    <config-ctn v-else title="页面配置">
      <page-config></page-config>
    </config-ctn>
  </div>
</template>

<script>
import PageConfig from "@/components/PageConfig";
export default {
  components: {
    PageConfig,
  },

  inject: ["control"],

  computed: {
    curSchema() {
      // console.log(
      //   "wang",
      //   this.control.curPage.componentList,
      //   this.control.curWidget,
      //   this.$fields[this.control.curWidget.component]
      // );
      // let name = this.control.curWidget.component;
      // let list = this.control.curPage.componentList;
      // list.forEach((item) => {
      //   if (item.component == "McGoods") {
      //     localStorage.setItem(key, value)
      //   }
      // });
      return this.$fields[this.control.curWidget.component];
    },
    created() {
      this.control = this.$store.getters.data().pagecontrol;
    },
    data() {
      return {
        control: null,
      };
    },
  },
};
</script>

<style lang='scss'>
</style>
